package org.thread.Homework04;/*
 *@Author: gjh
 *Date: 2025/3/12 8:10
 *Describe:
 */

import java.util.concurrent.Callable;

public class MyCallable implements Callable<Integer> {
    private String name;

    public MyCallable(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public Integer call() throws Exception {
        int num = 0;
        boolean flag = true;
        while (flag){
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            flag =  MainTest.mainTest.sellFilmNum();
            System.out.println("电影"+getName()+"已卖电影票"+num++);
        }
        return num;
    }
}
